//获取资产信息
import axiosReq from "@/utils/axios-req";
import nistReq from "@/utils/nist-req";

export const assetsInfoReq = (subForm):Promise<any>=>{
    // console.log(subForm)
    return new Promise((resolve)=>{
        const reqConfig={
            url: '/asset/getAssetsInfo',
            params:subForm,
            method:'post'
        }
        axiosReq(reqConfig).then((data)=>{
            resolve(data)
        })
    })
}

export const getAssetInfo = (subForm):Promise<any>=>{
    return new Promise((resolve)=>{
        const reqConfig={
            url:'/asset/getAssetInfo',
            params:subForm,
            method:'post'
        }
        axiosReq(reqConfig).then((data)=>{
            resolve(data)
        })
    })
}

export const vulnerabilitiesInfoReq = (subForm):Promise<any>=>{
    return new Promise((resolve)=>{
        const reqConfig={
            url:'/asset/getVulnerabilities',
            params: subForm,
            method: 'post'
        }
        axiosReq(reqConfig).then((data)=>{
            resolve(data)
        })
    })
}

export const servicesInfoReq = (subForm):Promise<any>=>{
    return new Promise((resolve)=>{
        const reqConfig={
            url:'/asset/getServices',
            params:subForm,
            method:'post'
        }
        axiosReq(reqConfig).then((data)=>{
            resolve(data)
        })
    })
}

export const getVulnerability = (subForm)=>{
    let header = new Headers()
    header.append('apiKey','d31fd7c8-b80a-41ca-9450-3d7e2f1786e2')
    return new Promise(resolve => {
        const reqConfig = {
            params: subForm,
            method: 'get'
        }
        nistReq(subForm).then((data)=>{
            resolve(data)
        })
    })
}